<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
    <meta charset="UTF-8">
    <title>图片压缩</title>
    <script src="jquery-1.7.2.min.js"></script>
    <script>
        $(function () {
            $('#upload').submit(function () {
                var t = 0;
                var i = setInterval(function () {
                    t++;
                    $('#message').html('处理中，已等待'+t+"秒")
                    $.get('isfile.php',{},function (rs) {
                        if(rs.status == 200){
                            //结束，清理内容
                            clearInterval(i);
                            $('#message').html('<a href="'+rs.data+'">下载</a>');
                        }
                    })

                },1000);
            })
        })
    </script>
</head>
<body>
<form id='upload' action="do.php" method="post" enctype="multipart/form-data" target="myiframe">
   处理引擎：
    <input type="radio" name="type" value="png"   />pngquant
    <!--<input type="radio" name="type" value="optipng"  />optipng-->
    <!--<input type="radio" name="type" value="pngcrush"  />pngcrush-->

    <!--<input type="radio" name="type" value="pngout"  />pngout-->

    <input type="radio" name="type" value="tinypng" checked />  tinypng  <br />


    <input type="file" name="file"  />
    <br />
    <input type="submit" name="submit" value="上传" />
</form>
<div id="message"></div>
<iframe height="100px" width="100px" name="myiframe"></iframe>
</body>
</html>